//
//  EditCharteredOrderPreviewViewController.m
//  didacar
//
//  Created by Yang Yuexia on 15/12/7.
//  Copyright © 2015年 dzmmac. All rights reserved.
//

#import "EditCharteredOrderPreviewViewController.h"
#import "WTDynamicLabel.h"
#import "EditCharteredOrderViewController.h"
#import "MyCharteredBusViewController.h"

@interface EditCharteredOrderPreviewViewController ()

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *timeBgView_layout_height;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *topView_layout_height;

@property (weak, nonatomic) IBOutlet UILabel *backTimeTitle;

@property (weak, nonatomic) IBOutlet UIButton *commitButton; // 提交按钮

@property (weak, nonatomic) IBOutlet UILabel *startPoint; // 出发地

@property (weak, nonatomic) IBOutlet UILabel *endPoint; // 目的地

@property (weak, nonatomic) IBOutlet UILabel *busType; // 包车方式

@property (weak, nonatomic) IBOutlet UILabel *goTime; // 出发时间

@property (weak, nonatomic) IBOutlet UILabel *backTime; // 返程时间

@property (weak, nonatomic) IBOutlet UILabel *peopleNum; // 乘车人数

@property (weak, nonatomic) IBOutlet UILabel *busNum; // 车辆数量

@property (weak, nonatomic) IBOutlet UILabel *contactName; // 联系人

@property (weak, nonatomic) IBOutlet UILabel *contactPhone; // 联系电话

@property (weak, nonatomic) IBOutlet WTDynamicLabel *tempRemark;


- (IBAction)commitAction:(id)sender;

@end

@implementation EditCharteredOrderPreviewViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"预览";
    [self setUpRemarkAnimation];
    
    self.commitButton.layer.cornerRadius = 4.0;
    self.commitButton.layer.masksToBounds = YES;
    
    if (self.charteredBusType == Enum_CharteredBusType_Items_single) {
        self.timeBgView_layout_height.constant = 36;
        self.topView_layout_height.constant = 303;
        self.backTimeTitle.hidden = YES;
        self.backTime.hidden = YES;
    }else{
        self.timeBgView_layout_height.constant = 60;
        self.topView_layout_height.constant = 329;
        self.backTimeTitle.hidden = NO;
        self.backTime.hidden = NO;
    }
    
}

#pragma mark ---- 设置备注动画 ----
- (void)setUpRemarkAnimation
{
    self.tempRemark.speed = 0.6;
    self.tempRemark.text = @"我不想说再见";
    self.tempRemark.textColor = UI_RGBA_HEX(0x666666);
    self.tempRemark.font = [UIFont systemFontOfSize:12];
}

#pragma mark ---- 提交 ----
- (IBAction)commitAction:(id)sender
{
    [self.navigationController.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        UIViewController *viewController = (UIViewController *)obj;
        if ([viewController isKindOfClass:[MyCharteredBusViewController class]]) {
            [self.navigationController popToViewController:viewController animated:YES];
        }
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end
